package com.bw.controller;

import com.bw.bean.AA;
import com.bw.bean.AB;
import com.bw.service.Servicedao;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
public class controller {
    @Autowired
    Servicedao dao;

    @RequestMapping("/list1")
    public Map getlist1()
    {
        List<AA> list = dao.getlist1();
        return SugarUtil.getBarData(list);
    }
    @RequestMapping("/list2")
    public Map getlist2()
    {
        List<AA> list = dao.getlist2();
        return SugarUtil.getPieData(list);
    }
    @RequestMapping("/list3")
    public Map getlist3()
    {
        List<AA> list = dao.getlist3();
        return SugarUtil.getPieData(list);
    }

    @RequestMapping("/list4")
    public String  getlist4()
    {
        List<AB> list = dao.getlist4();
        ArrayList list2=new ArrayList();
        list2.add("品牌");
        list2.add("性别");
        list2.add("总金额");
        return SugarUtil.getTablePlayData(list2,list);
    }

}
